package com.controller;

import com.entity.User;
import com.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

/**
 * @auther: zhangxin
 * @Description:
 */
@Controller
public class UserController {

    @Autowired
    private UserService userService;

    @RequestMapping("/users/list")
    public ModelAndView list() {
        //模拟查询商品列表
        List<User> list = userService.selectAll();
        ModelAndView mav = new ModelAndView();
        mav.addObject("userList", list);
        mav.setViewName("/user/list");
        return mav;
    }
}
